/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package calibracaolion;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Santi
 */
@Entity
@Table(name = "classes", catalog = "geins", schema = "")
@NamedQueries({
    @NamedQuery(name = "Classes.findAll", query = "SELECT c FROM Classes c"),
    @NamedQuery(name = "Classes.findByCodClasse", query = "SELECT c FROM Classes c WHERE c.codClasse = :codClasse"),
    @NamedQuery(name = "Classes.findByClasse", query = "SELECT c FROM Classes c WHERE c.classe = :classe")})
public class Classes implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "cod_classe")
    private Integer codClasse;
    @Basic(optional = false)
    @Column(name = "classe")
    private String classe;
    @OneToMany(mappedBy = "codClasse")
    private List<Instrumentos> instrumentosList;

    public Classes() {
    }

    public Classes(Integer codClasse) {
        this.codClasse = codClasse;
    }

    public Classes(Integer codClasse, String classe) {
        this.codClasse = codClasse;
        this.classe = classe;
    }

    public Integer getCodClasse() {
        return codClasse;
    }

    public void setCodClasse(Integer codClasse) {
        Integer oldCodClasse = this.codClasse;
        this.codClasse = codClasse;
        changeSupport.firePropertyChange("codClasse", oldCodClasse, codClasse);
    }

    public String getClasse() {
        return classe;
    }

    public void setClasse(String classe) {
        String oldClasse = this.classe;
        this.classe = classe;
        changeSupport.firePropertyChange("classe", oldClasse, classe);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codClasse != null ? codClasse.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Classes)) {
            return false;
        }
        Classes other = (Classes) object;
        if ((this.codClasse == null && other.codClasse != null) || (this.codClasse != null && !this.codClasse.equals(other.codClasse))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "calibracaolion.Classes[codClasse=" + codClasse + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
